<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Plate/index')}">列表</a></li>
<!--        <li><a href="{:url('Plate/add')}">添加</a></li>-->
    </ul>
    <form class=" well form-inline margin-top-20" method="post"  id="ljz-form-search">
        类型:
        <select name="type" class="form-control">
            <option value="">请选择</option>
            <foreach name="type_arr" item="vo1"  key="k" >

                <option
                <if isset($vo.type)&&$vo.type==$k>selected</if>
                value="{$k}">{$vo1}</option>
            </foreach>


        </select>
        归属类型:
        <select name="companytype" class="form-control">
            <option value="">请选择</option>
            <volist name="companytypea_arr1" id="ao">

                <option
                <if isset($vo.companytype)&&$vo.companytype==$ao.id>selected</if>
                value="{$ao.id}">{$ao.name}</option>
            </volist>
        </select>
        捆包号:
        <input type="text" class="form-control" name="name" style="width:150px;"
               value="{$vo.name|default=''}" placeholder="">
        成品牌号:
        <select name="grade_id" class="form-control">
            <option value="">请选择</option>
            <volist name="grade_id_arr1" id="ao">
                <option
                <if isset($vo.grade_id)&&$vo.grade_id==$ao.id>selected</if>
                value="{$ao.id}">{$ao.g_name}</option>
            </volist>
        </select>
        原料钢种:
        <select name="steel_id" class="form-control">
            <option value="">请选择</option>
            <volist name="steel_id_arr1" id="ao">
                <option
                <if isset($vo.steel_id)&&$vo.steel_id==$ao.id>selected</if>
                value="{$ao.id}">{$ao.name}</option>
            </volist>
        </select>
        <div></div>
        <br>
        钢卷号:
        <select name="coil_id" class="form-control">
            <option value="">请选择</option>
            <volist name="coil_id_arr1" id="ao">
                <option
                <if isset($vo.coil_id)&&$vo.coil_id==$ao.id>selected</if>
                value="{$ao.id}">{$ao.coilno}</option>
            </volist>
        </select>
        厚:
        <input placeholder="" type="text" class="form-control" name="d" value="{$vo.d|default=''}">
        宽:
        <input placeholder="" type="text" class="form-control" name="w" value="{$vo.w|default=''}">
        长:
        <input placeholder="" type="text" class="form-control" name="h" value="{$vo.h|default=''}">
        重量(吨):
        <input placeholder="" type="text" class="form-control" name="weight" value="{$vo.weight|default=''}">
        <div></div>
        <br>
        合同号:
        <select name="ht_id" class="form-control">
            <option value="">请选择</option>
            <volist name="ht_id_arr1" id="ao">
                <option
                <if isset($vo.ht_id)&&$vo.ht_id==$ao.id>selected</if>
                value="{$ao.id}">{$ao.ht_number}</option>
            </volist>
        </select>
        张数:
        <input placeholder="" type="text" class="form-control" name="sheets" value="{$vo.sheets|default=''}">
        库位:
        <input placeholder="" type="text" class="form-control" name="kuwei" value="{$vo.kuwei|default=''}">
        客户名称:
        <select name="company_id" class="form-control" id="company_id">
            <option value="">请选择</option>
            <volist name="company_id_arr1" id="ao">
                <option
                <if isset($vo.company_id)&&$vo.company_id==$ao.id>selected</if>
                value="{$ao.id}">{$ao.name}</option>
            </volist>
        </select>
        备注:
        <input placeholder="" type="text" class="form-control" name="remark" value="{$vo.remark|default=''}">


        <button class="btn btn-primary" id="bt_search">搜索</button>
        <button class="btn btn-primary" id="bt_output">导出</button>

        <a class="btn btn-danger" href="{:url('Plate/index')}">清空</a>
    </form>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>类型</th>
            <th>归属类型</th>
            <th>捆包号</th>
            <th>成品牌号</th>
            <th>原料钢种</th>
            <th>钢卷号</th>
            <th>厚</th>
            <th>宽</th>
            <th>长</th>
            <th>重量(吨)</th>   <th>单价</th>
            <th>合同号</th>
            <th>客户名称</th>
            <th>张数</th>
            <th>库位</th>
            <th>原捆包号</th>
            <th>备注</th>
            <th>添加时间</th>
            <th>更新时间</th>
            <th>最后操作人</th>
            <th width="150">操作</th>
        </tr>
        </thead>
        <tbody>
        <php>$type=array(1=>'成品库',2=>'实验库',3=>'废料库',4=>'半成品库',5=>'头尾库',6=>'封闭库',7=>'原料库',8=>'委外库');</php>
        <foreach name="lists['data']" item="vo">
            <tr>
                <td>
                    {$type[$vo['type']]|default=''}
                </td>
                <td>{$companytypea_arr[$vo['companytype']]|default=''}</td>
                <td>
                    {$vo['name']|default=''}
                </td>
                <td>
                    {$grade_id_arr[$vo['grade_id']]|default=''}
                </td>
                <td>
                    {$steel_grade_id_arr[$vo['steel_id']]|default=''}
                </td>
                <td>
                    {$coil_id_arr_da[$vo['coil_id']]|default=''}
                </td>
                <td>
                    {$vo['d']|default=''}
                </td>
                <td>
                    {$vo['w']|default=''}
                </td>
                <td>
                    {$vo['h']|default=''}
                </td>
                <td>
                    {$vo['weight']|default=''}
                </td>
                <td>
                    {$ht_id_arr[$vo['ht_id']]|default=''}
                </td>
                <td>
                     <php>$vo['company_id']=explode(',',  $vo['company_id']);</php>
                    <foreach name="vo['company_id']" item="vo1">
                        <if condition="$vo1!=0" >
                            {$company_id_arr[$vo1]['abb_name']|default=$company_id_arr[$vo1]['name']},

                        </if>
                    </foreach>
                </td>
                <td>
                    {$vo['sheets']|default=''}
                </td>
                <td>
                    {$vo['kuwei']|default=''}
                </td>
                <td>
                    {$plate_id_arr[$vo['parent_id']]|default=''}
                </td>
                <td>
                    {$vo['remark']|default=''}
                </td>
                <td>
                    {:date('Y-m-d H:i',$vo['add_time'])}
                </td>
                <td>
                    {:date('Y-m-d H:i',$vo['update_time'])}
                </td>
                <td>
                    {$user_arr[$vo['admin_id']]|default=''}
                </td>
                <td>
                    <if condition="!$vo['name']">
                        <a class="btn btn-xs btn-danger js-ajax-dialog-btn" data-msg="确定入库并生成捆包号吗？" href="{:url('Plate/confirm',['id'=>$vo['id']])}">确认入库</a>
                    </if>
                    <a class="btn btn-xs btn-primary" href="{:url('Plate/edit',['id'=>$vo['id']])}">编辑</a>
                    <a class="btn btn-xs btn-primary" href="{:url('Plate/tcpdf',['id'=>$vo['id']])}">打印</a>
                    <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Plate/del',['id'=>$vo['id']])}">删除</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="/static/js/admin.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script>
    function see(obj) {
        layer.open({
            content: $(obj).text().trim()
        });
    }
    $(function () {
        // 条件查询
        $("#bt_search").click(function(){
            $("#ljz-form-search").removeAttr('action');
            $("#ljz-form-search").attr('action',"{:url('Plate/index')}" );
            $("#ljz-form-search").submit();
        });
        // 数据导出成excel表格
        $("#bt_output").click(function(){
            $("#ljz-form-search").removeAttr('action');
            $("#ljz-form-search").attr('action',"{:url('Plate/outexcelpandian')}");
            $("#ljz-form-search").submit();
        });
    });
    function detail(id, field) {
        $.ajax({
            url: '{:url('Plate / field
        ')}?id=' + id + '&field=' + field,
            type
    :
        'get',
            success(res)
        {
            if (res.code == 1) {
                let tpl = '';
                for (const item of res.data) {
                    tpl += `<p>地址：<input value="${item}" readonly class="form-control" style="width:80%;display: inline-block;" type="text">&nbsp;<a target="_blank" href="{$domain}${item}" class="btn btn-success">跳转</a></p>`;
                }
                layer.open({
                    area: ['60%', '100%'],
                    content: tpl
                });
            } else {
                layer.msg('查看失败');
            }
        }
    })
        ;
    }
</script>
</body>
</html>
</body>
</html>
